<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <style type="text/css">
        body,
        fds input,
        #list {
            margin: 0;
            padding: 0;
        }
        
        html,
        body {
            height: 100%
        }
        
        fds {
            windth: 200px;
            margin: 0 auto;
            text-align: center;
        }
        
        #btn,
        #list {
            cursor: pointer;
        }
        
        fds #btn {
            margin-top: 20px;
        }
        
        fds #list {
            border: 1px black solid;
            width: 40px;
            margin: 5px auto;
            list-style-type: none;
            display: none
        }
        
        #list #last {
            border-top: 1px black solid;
        }
    </style>
</head>

<body>
    <div class="fds">
        <input type="button" id="btn" value="输入法">
        <ul id="list">
            <li>简写</li>
            <li>拼音</li>
            <li id="last">关闭</li>
        </ul>
    </div>
</body>

</html>
<script>
    var axp = document.getElementById("btn");
    var fds = document.getElementById("list");
    var axp1 = fds.getElementsByTagName("li");
    var fds1 = document.getElementById("last");
    fds1.onclick = function() {
        fds.style.display = "none";
    }
    axp.onclick = function() {
        if (fds.style.display != "block") {
            fds.style.display = "block";
        } else {
            fds1.onclick();
        }
    }
    for (var i = 0; i < axp1.length; i++) {
        axp1[i].onmouseover = function() {
            this.style.background = "#d14848";
        }
        axp1[i].onmouseout = function() {
            this.style.background = "";
        }
    }
</script>